<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>广软课室申请后台管理系统</title>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" th:href="@{../x-admin/css/font.css}">
    <link rel="stylesheet" th:href="@{../x-admin/css/xadmin.css}">
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script th:src="@{../x-admin/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{../x-admin/js/xadmin.js}"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script th:src="@{https://cdn.staticfile.org/html5shiv/r29/html5.min.js}"></script>
    <script th:src="@{https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js}"></script>
    <![endif]-->
    <script>
        // 是否开启刷新记忆tab功能
        // var is_remember = false;
    </script>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <div class="layui-inline layui-show-xs-block">
                        <input type="text" name="roomId" id="roomId" placeholder="请输入课室" autocomplete="off"
                               class="layui-input"></div>
                    <div class="layui-inline layui-show-xs-block">
                        <button class="layui-btn" lay-submit="" lay-filter="sreach" type="submit"
                                th:onclick="|javascript:searchRoom()|">
                            <i class="layui-icon">&#xe615;</i></button>
                    </div>
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>课室</th>
                            <th>容纳人数</th>
                            <th>拥有设备</th>
                            <th>位置</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <div th:each="room,roomStat :${rooms}">
                            <tr>
                                <td>[[${room.roomId}]]</td>
                                <td>[[${room.roomSize}]]</td>
                                <td>[[${room.roomDes}]]</td>
                                <td>[[${room.roomLoc}]]</td>
                                <td class="td-manage">
                                    <a title="查看空闲时间" th:href="|javascript:openInfo('${room.roomId}')|">
                                        <span class="layui-btn layui-btn-normal layui-btn-mini">查看空闲时间</span>
                                    </a>
                                </td>
                            </tr>
                        </div>
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div id="page">
                            <a class="prev" th:if="${toRoompageInfo.pageNum!=1}" th:href="@{/admin/toRoom/(pageNum=1)}"
                               aria-label="Previous">首页</a>
                            <a class="prev" th:if="${toRoompageInfo.pageNum!=1}"
                               th:href="@{/admin/toRoom/(pageNum=${toRoompageInfo.hasPreviousPage}?${toRoompageInfo.prePage}:${toRoompageInfo.pages})}"
                               aria-label="Previous">上一页</a>
                            <a class="next" th:text="第+${toRoompageInfo.pageNum}+页"></a>
                            <a class="next" th:text="共+${toRoompageInfo.pages}+页"></a>
                            <a class="next" th:if="${toRoompageInfo.pageNum != toRoompageInfo.pages}"
                               th:href="@{/admin/toRoom/(pageNum=${toRoompageInfo.hasNextPage}?${toRoompageInfo.nextPage}:${toRoompageInfo.pages})}"
                               aria-label="Next">下一页</a>
                            <a class="next" th:if="${toRoompageInfo.pageNum != toRoompageInfo.pages}"
                               th:href="@{/admin/toRoom/(pageNum=${toRoompageInfo.pages})}" aria-label="Next">尾页</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function openInfo(roomId) {
        console.log(roomId);
        let url = '/student/openRoomInfo?roomId=' + roomId;
        xadmin.open('课室空闲时间', url, 600, 500);
    }
    function searchRoom() {
        let roomId = $('#roomId').val();
        console.log(roomId);
        let url = "/student/getRoomById?roomId=" + roomId
        let title = roomId + "的信息"
        xadmin.open(title, url,1000,500)
    }
</script>
<script>
    layui.use(['laydate', 'form'],
        function () {
            var laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });
            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });
</script>
</html>